﻿using ExportExcelDemo.Core.Models;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExportExcelDemo.Core
{
    public class StudentManager
    {

        public void InsertStudent(Student model)
        {
            try
            {
                var sql = @"insert into Student(Name,Grade,Age,SchoolNum) values(@Name,@Grade,@Age,@SchoolNum)";
                SqlHelper.ExecuteNonquery(sql, System.Data.CommandType.Text, new System.Data.SqlClient.SqlParameter[] {
                new SqlParameter("@Name",model.Name),
                new SqlParameter("@Grade",model.Grade),
                new SqlParameter("@Age",model.Age),
                new SqlParameter("@SchoolNum",model.SchoolNum)
            });
            }
            catch(Exception ex)
            {
                throw ex;
            }
        
        }


    }
}
